ans = 0


def to2(num):
    res = 0
    while num:
        res += num % 2
        num //= 2
    return res


def to4(num):
    res = 0
    while num:
        res += num % 4
        num //= 4
    return res


for i in range(1, 2025):
    if to2(i) == to4(i):
        ans += 1
print(ans)
